-- Session table

create table WtSession
(
  sessionId char(32) not null primary key clustered,
  creationTime datetime not null default NOW(),
  accessTime datetime not null default NOW(),
  userIp char(15),
  userAgent char(128)
)
go

create index accessTimeIdx on WtSession(accessTime)
go

-- Session entry table

create table WtSessionEntry
(
  name varbinary(256) not null primary key clustered,
  sessionId char(32) not null
    references WtSession(sessionId) on delete cascade,
  value varbinary(8000)
)
go

create index sessionIdIdx on WtSessionEntry(sessionId)
go
